<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>spcompack</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 14/04/2005</div>
    <p>
      <b>spcompack</b> -  converts a compressed adjacency representation</p>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>xadj</b>
        </tt>:  integer vector of length (n+1).</li>
      <li>
        <tt>
          <b>xlindx</b>
        </tt>:  integer vector of length n+1 (pointers).</li>
      <li>
        <tt>
          <b>lindx</b>
        </tt>:  integer vector</li>
      <li>
        <tt>
          <b>adjncy</b>
        </tt>:  integer vector</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <pre>

Utility fonction spcompak is used to convert a compressed adjacency
representation into standard adjacency representation.
   
    </pre>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

// A is the sparse matrix:
A=[1,0,0,0,0,0,0;
   0,1,0,0,0,0,0;
   0,0,1,0,0,0,0;
   0,0,1,1,0,0,0;
   0,0,1,1,1,0,0;
   0,0,1,1,0,1,0;
   0,0,1,1,0,1,1];
A=sparse(A);
//For this matrix, the standard adjacency representation is given by:
xadj=[1,2,3,8,12,13,15,16];
adjncy=[1, 2, 3,4,5,6,7, 4,5,6,7, 5, 6,7, 7];
//(see sp2adj).
// increments in vector xadj give the number of non zero entries in each column
// ie there is 2-1=1 entry in the column 1
//    there is 3-2=1 entry in the column 2
//    there are 8-3=5 entries in the column 3
//              12-8=4                      4
//etc
//The row index of these entries is given by the adjncy vector
// for instance, 
// adjncy (3:7)=adjncy(xadj(3):xadj(4)-1)=[3,4,5,6,7] 
// says that the 5=xadj(4)-xadj(3) entries in column 3 have row
// indices 3,4,5,6,7.
//In the compact representation, the repeated sequences in adjncy
//are eliminated.
//Here in adjncy the sequences 4,5,6,7  and 7 are eliminated.
//The standard structure (xadj,adjncy) takes the compressed form (lindx,xlindx)
lindx=[1, 2, 3,4,5,6,7, 5, 6,7];
xlindx=[1,2,3,8,9,11];
//(Columns 4 and 7 of A are eliminated).
//A can be reconstructed from (xadj,xlindx,lindx).
[xadj,adjncy,anz]= sp2adj(A);
adjncy-spcompack(xadj,xlindx,lindx)
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="sp2adj.htm">
        <tt>
          <b>sp2adj</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="adj2sp.htm">
        <tt>
          <b>adj2sp</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="spget.htm">
        <tt>
          <b>spget</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
